package com.tornado.system.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tornado.system.mapper.ShoppingMapper;
import com.tornado.system.model.Goods;
import com.tornado.system.model.Shopping;
@Service
public class shoppingService implements IshoppingService{
	@Autowired
	private ShoppingMapper shoppingMapper;
	/**
	 * 通过id查询，返回shopping对象
	 */
	public Shopping load(int id) {
		return shoppingMapper.selectByPrimaryKey(id);	 
	}
	/**
	 * 返回shopping中所有对象
	 */
	public List<Shopping> getShoppinglist() {
		return shoppingMapper.shoppingList();
	}
	public Shopping selectByug(int id, int goodsId) {
		return shoppingMapper.userofshopping(id, goodsId);
	}
	public int insertRecord(Shopping shopping) {
		return shoppingMapper.insert(shopping);
	}
	public int updateSopCount(int count,int id) {
		// TODO Auto-generated method stub
		return shoppingMapper.updateCount(count, id);
	}
	public int deleterecord(int id) {
		return shoppingMapper.deleteByPrimaryKey(id);
	}
}
